package com.wc.alorithm_luogu.P1618;


import java.util.HashSet;
import java.util.Scanner;

/**
 * @Author congge
 * @Date 2023/5/24 11:07
 * @description https://www.luogu.com.cn/problem/P1618
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();

        int minGcd = gcd(A, B, C);


        HashSet<Integer> set = new HashSet<>();

        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                for (int k = 1; k <= 9; k++) {
                    if (i != j && j != k && i != k) {
                        set.add(i * 100 + j * 10 + k);
                    }
                }
            }
        }
        System.out.println(set.size());
    }

    static int gcd(int a, int b) {
        if (a > b) {
            return gcd(b, a);
        }
        int tmp;
        while (a != 0) {
            tmp = b % a;
            b = a;
            a = tmp;
        }
        return b;
    }

    static int gcd(int a, int b, int c) {
        return gcd(gcd(a, b), gcd(b, c));
    }
}
